home *** CD-ROM | disk | FTP | other *** search
- cseg segment para public 'code'
- org 100h
-
- ; This program is used to perform a reboot. The options are:
- ; /L - same as power-on, with full diagnostics
- ; /N or no option - same as Alt-Ctrl-Del
- ; /S - soft boot that preserves memory, except memory-resident programs. Some
- ; interrupt vectors are reset to their original value.
-
- bdata segment at 40h
- filler db 72h dup(?)
- reset_flag dw ?
- bdata ends
-
- pwron segment at 0ffffh
- reset label far
- pwron ends
-
- boot proc far
- assume cs:cseg,ds:nothing,ss:nothing,es:nothing
-
- mov dx,offset copyr ; print copyright
- mov ah,9
- int 21h
-
- mov si,80h ; point to command line
- mov ch,0
- mov cl,[si] ; get length
- jcxz p040 ; no option - normal boot
-
- p010: inc si
- mov al,[si] ; get next character
- cmp al,'/' ; is it a slash?
- jz p020 ; yes
- loop p010 ; try the next one
- jmp p040 ; give up - normal boot
-
- p020: mov al,[si+1] ; get character after the slash
- cmp al,'l' ; long?
- jz p050 ; yes
- cmp al,'L' ; long?
- jz p050 ; yes
- cmp al,'s' ; short?
- jz p070 ; yes
- cmp al,'S' ; short?
- jz p070 ; yes
- ; must be normal
-
- p040: mov ax,1234h ; normal boot
- jmp p060
-
- p050: mov ax,0 ; long boot
- mov al,0ch ; turn off the drive
- mov dx,03f2h
- out dx,al
-
-
- p060: assume es:bdata ; normal & long boots
- mov bx,bdata
- mov es,bx
- mov es:reset_flag,ax
- jmp reset ; jump to power-on entry point
-
- p070: assume es:nothing ; short boot
- mov ax,0
- mov es,ax
- mov bx,0f000h ; bios code segment
- cli ; turn off interrupts
-
- ; mov di,13h*4 ; fix int 13h - disk i/o
- ; mov ax,0ec59h
- ; call p080
-
- mov di,9h*4 ; fix int 9h - keyboard
- mov ax,0e987h
- call p080
-
- mov di,16h*4 ; fix int 16h - keyboard i/o
- mov ax,0e82eh
- call p080
-
- mov di,41ah ; fix keyboard buffer pointers
- push bx
- mov ax,1eh
- mov bx,ax
- call p080 ; set buffer head = tail
- pop bx ; get back segment
-
- mov di,10h*4 ; fix int 10h - video
- mov ax,0f065h
- call p080
-
- mov di,17h*4 ; fix int 17h - printer
- mov ax,0efd2h
- call p080
-
- mov di,1ch*4 ; fix int 1ch - timer
- mov ax,0ff53h
- call p080
-
- mov ax,0 ; clear user interrupts 60H - 67H
- mov di,60h*4
- mov cx,8*2 ; clear 8 interrupts
- rep stosw
-
- sti ; interrupts back on
- int 19h ; boot it
-
- p080 proc near ; restore interrupt vector
- mov es:[di],ax
- mov es:[di+2],bx
- ret
- p080 endp
-
- copyr db 'BOOT - Copyright 1983 Data Base Decisions',10,13,'$'
-
- boot endp
- cseg ends
- end boot
-